$(document).ready(function () {
    //时间初始化
    $("div#list div.query form input[name='Start']").val($.getDate(0, -1));
    $("div#list div.query form input[name='End']").val($.getCurrentDate());
    window.update = function (F) {
        var A = $("div#list table.list tbody");
        var P = F;
        A.empty();
        var I = "</td><td>";
        if (P && P.length > 0) {
            var C = 0,
				B = 0,
				O = 0,
				K = 0,
				D = 0;
            for (var J = 0; J < P.length; J++) {
                var E = P[J];
                var H = E.DayCount || 0;
                C += H;
                var N = E.CustomerCount || 0;
                B += N;
                var M = E.Adjust || 0;
                O += M;
                var G = E.Pay || 0;
                K += G;
                var L = E.Bonus || 0;
                D += L;
                A.append("<tr><td>" + E.Id + I + E.Name + I + H + I + N + I + M + I + G + I + L + I + (G + L) + "</td><td></td><td></td></tr>");
            }
            A.append("<tr><td>合计</td><td>" + P.length + "人</td><td>" + C + I + B + I + O + I + K + I + D + I + (K + D) + "</td><td></td><td></td></tr>");
        } else {
            A.append('<tr><td colspan="30">没有相关记录信息</td></tr>');
        }
    };
    $("div#list div.query button.query").click(function (A) {
        query($("div#list div.query form").serializeParam(), "QueryWage");
        return false;
    });
    query($("div#list div.query form").serializeParam(), "QueryWage");

    $("div#list div.query button.export").click(function () {
        var params = $("div#list div.query form").serializeParam();
        $.ajax({
            url: "../Export/QueryWage",
            dataType: "json",
            data: params,
            timeout: timeout,
            success: function (rep) {
                if (rep.Result) {
                    $.downloadFile('../Export/Download', 'post', rep.Message);
                } else {
                    alert(rep.Message);
                }
            }
        }).fail(function (T, S) {
            alert("浏览器超时未响应，请刷新重试");
        });
        return false;
    });
});